package com.lily.aidouzixun.adapter;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.lily.aidouzixun.R;
import com.lily.aidouzixun.activity.DynamicCollectActivity;
import com.lily.aidouzixun.activity.DynamicDetailActivity;
import com.lily.aidouzixun.activity.DynamicMineActivity;
import com.lily.aidouzixun.bean.DynamicCommentInfo;
import com.lily.aidouzixun.bean.DynamicInfo;
import com.lily.aidouzixun.bean.ArticleInfo;
import com.lily.aidouzixun.fragment.DynamicFragment;
import com.lily.aidouzixun.message.MessageDispatcher;
import com.lily.aidouzixun.message.MessageType;
import com.lily.aidouzixun.ui.CircleImageView;
import com.lily.aidouzixun.util.DateUtil;
import com.lily.aidouzixun.util.L;
import com.lily.aidouzixun.util.MyConfig;
import com.lily.aidouzixun.util.MyConstant;
import com.lily.aidouzixun.util.Validator;

/**
 * 创建ListView相关的ViewHolder和布局
 */
public class ViewHolderFactory {
	private static String TAG = "ViewHolderFactory";

	/**
	 * 得到Item布局
	 * 
	 * @param inflater
	 * @param type
	 * @return
	 */
	public View createConvertView(LayoutInflater inflater, int type) {
		// TODO Auto-generated method stub
		if (inflater != null) {
			switch (type) {
			case MyViewHolder.HolderType.ARTICLE: // 致文章列表
				return inflater.inflate(R.layout.longdistance_item, null);
			case MyViewHolder.HolderType.DISCUSS: // 动态列表
			case MyViewHolder.HolderType.DISCUSS_MINE:
			case MyViewHolder.HolderType.DISCUSS_COLLECT:
				return inflater.inflate(R.layout.discuss_item, null);
			case MyViewHolder.HolderType.DISCUSS_COMMENT: // 评论列表
				return inflater.inflate(R.layout.discusscomment_item, null);
			default:
				break;
			}
		} else {
				L.v(TAG, "createConvertView-->inflater is null!");
		}
		return null;
	}

	/**
	 * 得到Item上控件的持有对象
	 * 
	 * @param convertView
	 * @param type
	 * @param context
	 * @return
	 */
	public MyViewHolder createViewHolder(View convertView, int type,
			Context context) {
		// TODO Auto-generated method stub
		if (convertView != null) {
			switch (type) {
			case MyViewHolder.HolderType.ARTICLE:
				return new LongDistanceHolder(convertView, context);
			case MyViewHolder.HolderType.DISCUSS:	//动态列表
				return new DiscussHolder(convertView, context);
			case MyViewHolder.HolderType.DISCUSS_MINE:
				return new DiscussMineHolder(convertView, context);
			case MyViewHolder.HolderType.DISCUSS_COLLECT:	//动态收藏
				return new DynamicCollectHolder(convertView, context);
			case MyViewHolder.HolderType.DISCUSS_COMMENT:	//动态动态列表
				return new DiscussCommentHolder(convertView, context);
			default:
				break;
			}
		} else {
		}
		return null;
	}

	/**
	 * 文章Holder
	 */
	static class LongDistanceHolder extends MyViewHolder {
		ImageView imageView;
		TextView tvTitle;
		TextView tvBrowse;
		TextView tvComments;
		Context context;

		public LongDistanceHolder(View convertView, Context context) {
			imageView = (ImageView) convertView.findViewById(R.id.iv_longdistance_item);
			tvTitle = (TextView) convertView.findViewById(R.id.tv_longdistance_title);
			tvBrowse = (TextView) convertView.findViewById(R.id.tv_longdistance_browse);
			tvComments = (TextView) convertView.findViewById(R.id.tv_longdistance_comments);
			//tvSupport = (TextView) convertView.findViewById(R.id.tv_longdistance_support);

			this.context = context;
		}
		@Override
		public void setInfo(Object object, int type) {
			super.setInfo(object, type);
			ArticleInfo longDistanceInfo = (ArticleInfo) object;
			Glide.with(context)
					.load(longDistanceInfo.getImageUrl())
					.dontAnimate()
					.placeholder(R.mipmap.my_launcher)
					.into(imageView);
			tvTitle.setText(longDistanceInfo.getTitle());
			tvBrowse.setText(longDistanceInfo.getBrowse() + "");
			tvComments.setText(longDistanceInfo.getComments() + "");
		}
	}

	/**
	 * 动态Holder
	 */
	static class DiscussHolder extends MyViewHolder {
		CircleImageView civAvatar;
		TextView tvNickname;
		TextView tvPubtime;
		ImageView tvDelete;
		TextView tvContent;
		ImageView ivContent;
		TextView tvLeft;

		TextView tvCenter;
		TextView tvRight;
		Context context;

		public DiscussHolder(View convertView, final Context context) {
			this.context = context;
			civAvatar = (CircleImageView) convertView.findViewById(R.id.user_avatar);
			tvNickname = (TextView) convertView.findViewById(R.id.tv_nickname);
			tvPubtime = (TextView) convertView.findViewById(R.id.tv_pubtime);
			tvDelete = (ImageView) convertView.findViewById(R.id.iv_delete);
			tvContent = (TextView) convertView.findViewById(R.id.tv_discuss_content);
			ivContent = (ImageView) convertView.findViewById(R.id.iv_discuss);
			tvLeft = (TextView) convertView.findViewById(R.id.tv_left);
			tvCenter = (TextView) convertView.findViewById(R.id.tv_center);
			tvRight = (TextView) convertView.findViewById(R.id.tv_right);
		}
		@Override
		public void setInfo(Object object, int type) {
			super.setInfo(object, type);
			final DynamicInfo discussInfo = (DynamicInfo) object;
			if (Validator.isEffective(discussInfo.getImageUrl())) {
				ivContent.setVisibility(View.VISIBLE);
				Glide.with(context)
						.load(discussInfo.getImageUrl())
						.into(ivContent);
			} else {
				ivContent.setVisibility(View.GONE);
			}
			if (discussInfo.getUrid() .equals(MyConfig.getUserId(context))) {
				tvDelete.setVisibility(View.VISIBLE);
				tvDelete.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						new AlertDialog.Builder(context)
								.setTitle("温馨提示")
								.setMessage("是否确定删除？")
								.setPositiveButton("确定", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface dialogInterface, int i) {
										//发消息删除动态
										MessageDispatcher.sendMessage(DynamicFragment.getMyHandler(), MessageType.DELETE_DISCUSS, discussInfo.getDid());
									}
								})
								.setNegativeButton("取消", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface dialogInterface, int i) {
										dialogInterface.dismiss();
									}
								}).show();
					}
				});
			} else {
				tvDelete.setVisibility(View.GONE);
			}
			if (Validator.isEffective(discussInfo.getAvatar())) {
				Glide.with(context)
						.load(discussInfo.getAvatar())
						.dontAnimate()
						.placeholder(R.mipmap.my_launcher)
						.into(civAvatar);
			}

			tvNickname.setText(discussInfo.getNickName());
			tvPubtime.setText(DateUtil.timeLogic(discussInfo.getPubtime()));
			tvContent.setText(discussInfo.getContent());
			tvLeft.setText(discussInfo.getSupport() + "");
			if (discussInfo.getIsSupport() == 1) {
				tvLeft.setSelected(true);
			} else {
				tvLeft.setSelected(false);
			}
			tvLeft.setOnClickListener(new View.OnClickListener() {    //点赞
				@Override
				public void onClick(View view) {
					if (MyConfig.isLogined(context)) {
						if (tvLeft.isSelected()) {
							DynamicFragment.support(discussInfo.getDid(), DynamicFragment.ActionType.DOWN);
							tvLeft.setText((Integer.parseInt(tvLeft.getText().toString().trim()) - 1) + "");
							discussInfo.setSupport(discussInfo.getSupport() - 1);
							discussInfo.setIsSupport(0);
							tvLeft.setSelected(false);
						} else {
							DynamicFragment.support(discussInfo.getDid(), DynamicFragment.ActionType.UP);
							tvLeft.setText((Integer.parseInt(tvLeft.getText().toString().trim()) + 1) + "");
							discussInfo.setSupport(discussInfo.getSupport() + 1);
							discussInfo.setIsSupport(1);
							tvLeft.setSelected(true);
						}

					} else {
						//如果没有登录，先登录
						MessageDispatcher.sendMessage(DynamicFragment.getMyHandler(), MessageType.GOTO_LOGIN);
					}
				}
			});
			tvCenter.setText(discussInfo.getComments() + "");
			tvCenter.setOnClickListener(new View.OnClickListener() {    //点赞
				@Override
				public void onClick(View view) {
					if (MyConfig.isLogined(context)) {
						Intent discussDetailIntent = new Intent(context, DynamicDetailActivity.class);
						discussDetailIntent.putExtra(MyConstant.IntentKey.BACK_TITLE, "详情");
						discussDetailIntent.putExtra(MyConstant.IntentKey.FROM_TYPE, 1);
						discussDetailIntent.putExtra(MyConstant.IntentKey.DISCUSSINFO, discussInfo);
						context.startActivity(discussDetailIntent);
					} else {
						//如果没有登录，先登录
						MessageDispatcher.sendMessage(DynamicFragment.getMyHandler(), MessageType.GOTO_LOGIN);
					}
				}
			});
			tvRight.setText(discussInfo.getOpposition() + "");
			if (discussInfo.getIsCollect() == 1) {
				tvRight.setSelected(true);
			} else {
				tvRight.setSelected(false);
			}
			tvRight.setOnClickListener(new View.OnClickListener() {    //点赞
				@Override
				public void onClick(View view) {
					if (MyConfig.isLogined(context)) {
						if (tvRight.isSelected()) {
							DynamicFragment.collect(discussInfo.getDid(), DynamicFragment.ActionType.DOWN);
							tvRight.setText((Integer.parseInt(tvRight.getText().toString().trim()) - 1) + "");
							discussInfo.setOpposition(discussInfo.getOpposition() - 1);
							discussInfo.setIsCollect(0);
							tvRight.setSelected(false);
						} else {
							DynamicFragment.collect(discussInfo.getDid(), DynamicFragment.ActionType.UP);
							tvRight.setText((Integer.parseInt(tvRight.getText().toString().trim()) + 1) + "");
							discussInfo.setOpposition(discussInfo.getOpposition() + 1);
							discussInfo.setIsCollect(1);
							tvRight.setSelected(true);
						}

					} else {
						//如果没有登录，先登录
						MessageDispatcher.sendMessage(DynamicFragment.getMyHandler(), MessageType.GOTO_LOGIN);
					}
				}
			});
		}
	}

	/**
	 * 动态Holder
	 */
	static class DiscussMineHolder extends MyViewHolder {
		CircleImageView civAvatar;
		TextView tvNickname;
		TextView tvPubtime;
		ImageView tvDelete;
		TextView tvContent;
		ImageView ivContent;
		TextView tvLeft;

		TextView tvCenter;
		TextView tvRight;
		Context context;

		public DiscussMineHolder(View convertView, final Context context) {
			this.context = context;
			civAvatar = (CircleImageView) convertView.findViewById(R.id.user_avatar);
			tvNickname = (TextView) convertView.findViewById(R.id.tv_nickname);
			tvPubtime = (TextView) convertView.findViewById(R.id.tv_pubtime);
			tvDelete = (ImageView) convertView.findViewById(R.id.iv_delete);
			tvContent = (TextView) convertView.findViewById(R.id.tv_discuss_content);
			ivContent = (ImageView) convertView.findViewById(R.id.iv_discuss);
			tvLeft = (TextView) convertView.findViewById(R.id.tv_left);
			tvCenter = (TextView) convertView.findViewById(R.id.tv_center);
			tvRight = (TextView) convertView.findViewById(R.id.tv_right);
		}
		@Override
		public void setInfo(Object object, int type) {
			super.setInfo(object, type);
			final DynamicInfo discussInfo = (DynamicInfo) object;
			if (Validator.isEffective(discussInfo.getImageUrl())) {
				ivContent.setVisibility(View.VISIBLE);
				Glide.with(context)
						.load(discussInfo.getImageUrl())
						.into(ivContent);
			} else {
				ivContent.setVisibility(View.GONE);
			}
			if (discussInfo.getUrid() .equals(MyConfig.getUserId(context))) {
				tvDelete.setVisibility(View.VISIBLE);
				tvDelete.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						new AlertDialog.Builder(context)
								.setTitle("温馨提示")
								.setMessage("是否确定删除？")
								.setPositiveButton("确定", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface dialogInterface, int i) {
										//发消息删除动态
										MessageDispatcher.sendMessage(DynamicMineActivity.getMyHandler(), MessageType.DELETE_DISCUSS, discussInfo.getDid());
									}
								})
								.setNegativeButton("取消", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface dialogInterface, int i) {
										dialogInterface.dismiss();
									}
								}).show();
					}
				});
			} else {
				tvDelete.setVisibility(View.GONE);
			}
			if (Validator.isEffective(discussInfo.getAvatar())) {
				Glide.with(context)
						.load(discussInfo.getAvatar())
						.dontAnimate()
						.placeholder(R.mipmap.my_launcher)
						.into(civAvatar);
			}

			tvNickname.setText(discussInfo.getNickName());
			tvPubtime.setText(DateUtil.timeLogic(discussInfo.getPubtime()));
			tvContent.setText(discussInfo.getContent());
			tvLeft.setText(discussInfo.getSupport() + "");
			if (discussInfo.getIsSupport() == 1) {
				tvLeft.setSelected(true);
			} else {
				tvLeft.setSelected(false);
			}
			tvLeft.setOnClickListener(new View.OnClickListener() {    //点赞
				@Override
				public void onClick(View view) {
					if (MyConfig.isLogined(context)) {
						if (tvLeft.isSelected()) {
							DynamicMineActivity.support(discussInfo.getDid(), DynamicFragment.ActionType.DOWN);
							tvLeft.setText((Integer.parseInt(tvLeft.getText().toString().trim()) - 1) + "");
							discussInfo.setSupport(discussInfo.getSupport() - 1);
							discussInfo.setIsSupport(0);
							tvLeft.setSelected(false);
						} else {
							DynamicMineActivity.support(discussInfo.getDid(), DynamicFragment.ActionType.UP);
							tvLeft.setText((Integer.parseInt(tvLeft.getText().toString().trim()) + 1) + "");
							discussInfo.setSupport(discussInfo.getSupport() + 1);
							discussInfo.setIsSupport(1);
							tvLeft.setSelected(true);
						}

					} else {
						//如果没有登录，先登录
						MessageDispatcher.sendMessage(DynamicMineActivity.getMyHandler(), MessageType.GOTO_LOGIN);
					}
				}
			});
			tvCenter.setText(discussInfo.getComments() + "");
			tvCenter.setOnClickListener(new View.OnClickListener() {    //点赞
				@Override
				public void onClick(View view) {
					if (MyConfig.isLogined(context)) {
						Intent discussDetailIntent = new Intent(context, DynamicDetailActivity.class);
						discussDetailIntent.putExtra(MyConstant.IntentKey.BACK_TITLE, "详情");
						discussDetailIntent.putExtra(MyConstant.IntentKey.FROM_TYPE, 3);
						discussDetailIntent.putExtra(MyConstant.IntentKey.DISCUSSINFO, discussInfo);
						context.startActivity(discussDetailIntent);
					} else {
						//如果没有登录，先登录
						MessageDispatcher.sendMessage(DynamicFragment.getMyHandler(), MessageType.GOTO_LOGIN);
					}
				}
			});
			tvRight.setText(discussInfo.getOpposition() + "");
			if (discussInfo.getIsCollect() == 1) {
				tvRight.setSelected(true);
			} else {
				tvRight.setSelected(false);
			}
			tvRight.setOnClickListener(new View.OnClickListener() {    //点赞
				@Override
				public void onClick(View view) {
					if (MyConfig.isLogined(context)) {
						if (tvRight.isSelected()) {
							DynamicMineActivity.collect(discussInfo.getDid(), DynamicFragment.ActionType.DOWN);
							tvRight.setText((Integer.parseInt(tvRight.getText().toString().trim()) - 1) + "");
							discussInfo.setOpposition(discussInfo.getOpposition() - 1);
							discussInfo.setIsCollect(0);
							tvRight.setSelected(false);
						} else {
							DynamicMineActivity.collect(discussInfo.getDid(), DynamicFragment.ActionType.UP);
							tvRight.setText((Integer.parseInt(tvRight.getText().toString().trim()) + 1) + "");
							discussInfo.setOpposition(discussInfo.getOpposition() + 1);
							discussInfo.setIsCollect(1);
							tvRight.setSelected(true);
						}

					} else {
						//如果没有登录，先登录
						MessageDispatcher.sendMessage(DynamicMineActivity.getMyHandler(), MessageType.GOTO_LOGIN);
					}
				}
			});
		}
	}

	/**
	 * 动态收藏Holder
	 */
	static class DynamicCollectHolder extends MyViewHolder {
		CircleImageView civAvatar;
		TextView tvNickname;
		TextView tvPubtime;
		ImageView tvDelete;
		TextView tvContent;
		ImageView ivContent;
		TextView tvLeft;

		TextView tvCenter;
		TextView tvRight;
		Context context;

		public DynamicCollectHolder(View convertView, final Context context) {
			this.context = context;
			civAvatar = (CircleImageView) convertView.findViewById(R.id.user_avatar);
			tvNickname = (TextView) convertView.findViewById(R.id.tv_nickname);
			tvPubtime = (TextView) convertView.findViewById(R.id.tv_pubtime);
			tvDelete = (ImageView) convertView.findViewById(R.id.iv_delete);
			tvContent = (TextView) convertView.findViewById(R.id.tv_discuss_content);
			ivContent = (ImageView) convertView.findViewById(R.id.iv_discuss);
			tvLeft = (TextView) convertView.findViewById(R.id.tv_left);
			tvCenter = (TextView) convertView.findViewById(R.id.tv_center);
			tvRight = (TextView) convertView.findViewById(R.id.tv_right);
		}
		@Override
		public void setInfo(Object object, int type) {
			super.setInfo(object, type);
			final DynamicInfo discussInfo = (DynamicInfo) object;
			if (Validator.isEffective(discussInfo.getImageUrl())) {
				ivContent.setVisibility(View.VISIBLE);
				Glide.with(context)
						.load(discussInfo.getImageUrl())
						.into(ivContent);
			} else {
				ivContent.setVisibility(View.GONE);
			}
			if (discussInfo.getUrid() .equals(MyConfig.getUserId(context))) {
				tvDelete.setVisibility(View.VISIBLE);
				tvDelete.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						new AlertDialog.Builder(context)
								.setTitle("温馨提示")
								.setMessage("是否确定删除？")
								.setPositiveButton("确定", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface dialogInterface, int i) {
										//发消息删除动态
										MessageDispatcher.sendMessage(DynamicCollectActivity.getMyHandler(), MessageType.DELETE_DISCUSS, discussInfo.getDid());
									}
								})
								.setNegativeButton("取消", new DialogInterface.OnClickListener() {
									@Override
									public void onClick(DialogInterface dialogInterface, int i) {
										dialogInterface.dismiss();
									}
								}).show();
					}
				});
			} else {
				tvDelete.setVisibility(View.GONE);
			}
			if (Validator.isEffective(discussInfo.getAvatar())) {
				Glide.with(context)
						.load(discussInfo.getAvatar())
						.dontAnimate()
						.placeholder(R.mipmap.my_launcher)
						.into(civAvatar);
			}

			tvNickname.setText(discussInfo.getNickName());
			tvPubtime.setText(DateUtil.timeLogic(discussInfo.getPubtime()));
			tvContent.setText(discussInfo.getContent());
			tvLeft.setText(discussInfo.getSupport() + "");
			if (discussInfo.getIsSupport() == 1) {
				tvLeft.setSelected(true);
			} else {
				tvLeft.setSelected(false);
			}
			tvLeft.setOnClickListener(new View.OnClickListener() {    //点赞
				@Override
				public void onClick(View view) {
					if (MyConfig.isLogined(context)) {
						if (tvLeft.isSelected()) {
							DynamicCollectActivity.support(discussInfo.getDid(), DynamicFragment.ActionType.DOWN);
							tvLeft.setText((Integer.parseInt(tvLeft.getText().toString().trim()) - 1) + "");
							discussInfo.setSupport(discussInfo.getSupport() - 1);
							discussInfo.setIsSupport(0);
							tvLeft.setSelected(false);
						} else {
							DynamicCollectActivity.support(discussInfo.getDid(), DynamicFragment.ActionType.UP);
							tvLeft.setText((Integer.parseInt(tvLeft.getText().toString().trim()) + 1) + "");
							discussInfo.setSupport(discussInfo.getSupport() + 1);
							discussInfo.setIsSupport(1);
							tvLeft.setSelected(true);
						}

					} else {
						//如果没有登录，先登录
						MessageDispatcher.sendMessage(DynamicCollectActivity.getMyHandler(), MessageType.GOTO_LOGIN);
					}
				}
			});
			tvCenter.setText(discussInfo.getComments() + "");
			tvCenter.setOnClickListener(new View.OnClickListener() {    //点赞
				@Override
				public void onClick(View view) {
					if (MyConfig.isLogined(context)) {
						Intent discussDetailIntent = new Intent(context, DynamicDetailActivity.class);
						discussDetailIntent.putExtra(MyConstant.IntentKey.BACK_TITLE, "详情");
						discussDetailIntent.putExtra(MyConstant.IntentKey.FROM_TYPE, 2);
						discussDetailIntent.putExtra(MyConstant.IntentKey.DISCUSSINFO, discussInfo);
						context.startActivity(discussDetailIntent);
					} else {
						//如果没有登录，先登录
						MessageDispatcher.sendMessage(DynamicCollectActivity.getMyHandler(), MessageType.GOTO_LOGIN);
					}
				}
			});
			tvRight.setText(discussInfo.getOpposition() + "");
			if (discussInfo.getIsCollect() == 1) {
				tvRight.setSelected(true);
			} else {
				tvRight.setSelected(false);
			}
			tvRight.setOnClickListener(new View.OnClickListener() {    //点赞
				@Override
				public void onClick(View view) {
					if (MyConfig.isLogined(context)) {
						if (tvRight.isSelected()) {
							DynamicCollectActivity.collect(discussInfo.getDid(), DynamicFragment.ActionType.DOWN);
							tvRight.setText((Integer.parseInt(tvRight.getText().toString().trim()) - 1) + "");
							discussInfo.setOpposition(discussInfo.getOpposition() - 1);
							discussInfo.setIsCollect(0);
							tvRight.setSelected(false);
						} else {
							DynamicCollectActivity.collect(discussInfo.getDid(), DynamicFragment.ActionType.UP);
							tvRight.setText((Integer.parseInt(tvRight.getText().toString().trim()) + 1) + "");
							discussInfo.setOpposition(discussInfo.getOpposition() + 1);
							discussInfo.setIsCollect(1);
							tvRight.setSelected(true);
						}

					} else {
						//如果没有登录，先登录
						MessageDispatcher.sendMessage(DynamicCollectActivity.getMyHandler(), MessageType.GOTO_LOGIN);
					}
				}
			});
		}
	}

	/**
	 * 评论Holder
	 */
	static class DiscussCommentHolder extends MyViewHolder {
		CircleImageView civAvatar;
		TextView tvNickname;
		TextView tvPubtime;
		TextView tvComment;
		Context context;

		public DiscussCommentHolder(View convertView, Context context) {
			this.context = context;
			civAvatar = (CircleImageView) convertView.findViewById(R.id.user_avatar);
			tvNickname = (TextView) convertView.findViewById(R.id.tv_nickname);
			tvPubtime = (TextView) convertView.findViewById(R.id.tv_pubtime);
			tvComment = (TextView) convertView.findViewById(R.id.tv_discuss_comment);
		}
		@Override
		public void setInfo(Object object, int type) {
			super.setInfo(object, type);
			final DynamicCommentInfo discussComment = (DynamicCommentInfo) object;
			if (Validator.isEffective(discussComment.getAvatar())) {
				Glide.with(context)
						.load(discussComment.getAvatar())
						.dontAnimate()
						.placeholder(R.mipmap.my_launcher)
						.into(civAvatar);
			}
			tvNickname.setText(discussComment.getNickname());
			tvPubtime.setText(DateUtil.timeLogic(discussComment.getCreatedTime()));
			tvComment.setText(discussComment.getContent());
		}
	}
}
